MVC UI Jquery
@model HuaWei.ELab.Model.TSysDomain @{ 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>@ViewBag.Title</title> <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/css/index.css" /> <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/css/theme/easyui.css"/> <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/css/index.css" /> <link rel="stylesheet" type="text/css" href="http://www.cnblogs.com/css/Class.css" /> <script type="text/javascript" src="http://www.cnblogs.com/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://www.cnblogs.com/js/calendar/Calendar3.js"></script> <script type="text/javascript" src="http://www.cnblogs.com/js/jquery.easyui.min.js"></script> <script type="text/javascript" src="@Url.Content("~/js/common.js")"></script> <script type="text/javascript" src="http://www.cnblogs.com/js/index.js"></script> <script type="text/javascript"> // $(document).ready(function () { // //提交后禁用Submit按钮 // var reg = new RegExp("(^|&)domainId=([^&]*)(&|$)"); // var r = window.location.search.substr(1).match(reg); // if (r != null) { // $("#submitDomain").attr("disabled", "disabled"); // $("#resetDomain").attr("disabled", "disabled"); // resetDomain // } // //提交后禁用Submit/Reset按钮结束 // }) var flagIsExistName = true; var flagDes = true; var flagCss = true; var flagTimeZone = true; var flagNameLength = true; function ResetDomain() { $("#ParentName").combotree("setValue", '00000000-0000-0000-0000-000000000001'); $("#DomainName").val(""); $("#CategoryName").combotree("setValue", "00000000-0000-0000-0000-000000000000") $("#ProductLineName").combotree("setValue", "00000000-0000-0000-0000-000000000000") $("#OrganizationName").combotree("setValue", "00000000-0000-0000-0000-000000000000"), $("#TimeZoneName").combotree("setValue", "00000000-0000-0000-0000-000000000000"); $("#StyleName").combotree("setValue", "00000000-0000-0000-0000-000000000000"); $("#Enable").attr("checked", false); $("#InheritRole").attr("checked", false); $("#Remark").val(""); } function SumbmitDomain() { if (CheckValues()) { $.ajax({ url: '/Domain/Add', type: "POST", data: { xDomainId: $("#DomainID").val(), xParentId: $("#ParentName").combotree("getValue"), xParentName: encodeURIComponent($("#ParentName").combotree("getText")), xDomainName: encodeURIComponent($("#DomainName").val()), xDomainAdminId: $("#domainAdmin").combotree("getValue"), xDomainAdminName: encodeURIComponent($("#domainAdmin").combotree("getText")), xApproverId: $("#approver").combotree("getValue"), xApproverName: encodeURIComponent($("#approver").combotree("getText")), xIsEnable: $("#Enable").is(":checked"), xInheritRole: $("#InheritRole").is(":checked"), xCategoryId: $("#CategoryName").combotree("getValues"), xCategoryName: encodeURIComponent($("#CategoryName").combotree("getText")), xProductLineId: $("#ProductLineName").combotree("getValues"), xProductLineName: encodeURIComponent($("#ProductLineName").combotree("getText")), xOrganizationId: $("#OrganizationName").combo("getValues"), xOrganizationName: encodeURIComponent($("#OrganizationName").combo("getText")), xTimeZoneId: $("#TimeZoneName").combo("getValue"), xTimeZoneName: encodeURIComponent($("#TimeZoneName").combo("getText")), xStyleId: $("#StyleName").combo("getValue"), xStyleName: encodeURIComponent($("#StyleName").combo("getText")), xRemark: $("#Remark").val() }, success: function (result) { alert(result.message); if (result.DomainID != '00000000-0000-0000-0000-000000000000') { window.location.href = '@Url.Content("~/Domain/AddDomain")' + "?domainId=" + result.DomainID; } }, error: function (result) { alert(result.message); } }); } } function CheckValues() { //验证父节点不能选择自己和它的子节点作为自己的父节点! if (!flagParent) { return false; } //验证名称是否这空 if ($("#DomainName").val() == "" || $("#DomainName").val() == null) { $("#labMsg").html("DomainName不能为空!"); $("#DomainName").focus(); return false; } else { $("#labMsg").html(""); } //验证名称是否含指定的特殊字符 if (!validate()) { return false; } //验证名称是否存在 CheckName(); if (!flagIsExistName) { return false; } //验证时区必填项 if ($("#TimeZoneName").combo("getText") == "" || $("#TimeZoneName").combo("getText") == null) { $("#tzMsg").html("请选择一个时区!"); $("#TimeZoneName").focus(); return false; } else { $("#tzMsg").html(""); } //验证CSS必填项 CheckCss(); if (!flagCss) { return false; } //验证备注长度是否超过50 CheckDes(); if (!flagDes) { return false; } return true; }; //区域管理JS function CheckName() { var name = $("#DomainName").val(); //判断长度 var length = DataLength(name); if (length > 20) { $("#labMsg").html("英文长度不能超过20,中文长度不能超过10!"); flagNameLength = false; } else { $("#labMsg").html(""); flagNameLength = true; } var url = "IsExist?domainId=" + $("#DomainID").val() + "&domainName=" + name + "&parentId=" + $("#ParentID").val(); if (flagNameLength) { $.ajax({ type: "POST", url: url, success: function (msg) { if (msg == "True") { $("#labMsg").html("该域已存在!"); flagIsExistName = false; } else { $("#labMsg").html(""); flagIsExistName = true; } } }); } } function CheckDes() { var des = $("#Remark").val(); var length = DataLength(des); if (length > 50) { $("#desMsg").html("英文长度不能超过50,中文长度不能超过25!"); flagDes = false; } else { $("#desMsg").html(""); flagDes = true; } } function CheckCss() { var css = $("#StyleName").combo("getText") if (css == "") { $("#cssMsg").html("请选择一个CSS样式!"); flagCss = false; } else { $("#cssMsg").html(""); flagCss = true; } } var flagParent = true; $(function () { $("#ParentName").combotree({ onChange: function (a, b) { var parentId = $("#ParentName").combotree("getValue"); var domainId = '@ViewBag.DomainId'; var url = "CheckParentWhenEdit?domainId=" + domainId + "&parentId=" + parentId; ; //alert("Pid:"+parentId+"Did:"+domainId); $.post(url, function (data, state) { if (state == "success" && data == "False") { $("#parentMsg").html("父节点不能选择自己和它的子节点作为自己的父节点!"); flagParent = false; } else { $("#parentMsg").html(""); flagParent = true; } }) return true; } }); }); $(function () { //目录 var cStr = '@(Model.CategoryId == Guid.Empty.ToString() ? "" : Model.CategoryId)'; if (cStr != null && cStr != "") { cStr = cStr.toLowerCase(); } var cSwitch = cStr.replace(/,/g, "\"" + "," + "\""); var cArray = "[\"" + cSwitch + "\"]"; $('#CategoryName').combotree("setValues", eval(cArray)); //产品线 var pStr = '@(Model.ProductLineId == Guid.Empty.ToString() ? "" : Model.ProductLineId)'; if (pStr != null && pStr != "") { pStr = pStr.toLowerCase(); } var pSwitch = pStr.replace(/,/g, "\"" + "," + "\""); var pArray = "[\"" + pSwitch + "\"]"; $('#ProductLineName').combotree("setValues", eval(pArray)); //组织架构 var orgStr = '@(Model.OrganizationId == Guid.Empty.ToString() ? "" : Model.OrganizationId)'.toLowerCase(); var orgSwitch = orgStr.replace(/,/g, "\"" + "," + "\""); var orgArray = "[\"" + orgSwitch + "\"]"; $('#OrganizationName').combotree("setValues", eval(orgArray)); }); </script> <script type="text/javascript"> //区域管理JS $(function () { var domainId = '@(Model.DomainID)'; if (domainId != '@(Guid.Empty)') { $(".noneAdmin").removeClass("noneAdmin"); } }) </script> <style type="text/css"> /*Tab1*/ #lib_Tab1 { width:auto; margin:0px; padding:0px; margin-bottom:15px; } /*Tab2*/ #lib_Tab2 { width:576px; margin:0px; padding:0px; margin-bottom:15px; } .lib_tabborder { /* border:1px solid #cccccc; */ } .lib_Menubox { height:28px; line-height:28px; position:relative; } .lib_Menubox ul { margin:0px; padding:0px; list-style:none; position:absolute; top:3px; left:-1px; margin-left:35px; height:25px; text-align:center; } .lib_Menubox li { float:left; display:block; cursor:pointer; width:130px; color:#444; font-weight:bold; margin-right:2px; height:25px; line-height:25px; background: url("css/images/datagrid_header_bg.gif") repeat-x scroll left bottom #FAFAFA; } /* www.codefans.net */ .lib_Menubox li.hover { padding:0px; background:#fff; width:130px; border-left:1px solid #cccccc; border-top:1px solid #cccccc; border-right:1px solid #cccccc; color:#000; height:25px; line-height:25px; } .lib_Contentbox { clear:both; margin-top:0px; border:1px solid #cccccc; height:300px; text-align:center; padding-top:8px; overflow:auto; } .noneAdmin{display:none;} </style> </head>
阿里云: www.aliyun.com
华赐软件: www.huacisoft.com
C#开源社区: www.opencsharp.net
清泓美肤苑: 清泓美肤苑
bootstrap权限管理系统: Asp.Net Mvc3 bootstrap权限管理系统