华赐软件 Bootstrap3

角色权限功能点设置页面

HTML:

View Code
<div class="main p8_main">
            <div class="p5_main_right p8_main_right">
                <div class="p8_table_box Megalab_Class_main_right_content_table">
                    <div class="Megalab_Class_main_right_cont_bottom_box">
                        <!--最小行单元-->
                        @{
                            if (ViewData["OpList"] != null)
                            {
                                System.Data.DataTable opList = ViewData["OpList"] as System.Data.DataTable;
                                string menu = "00";
                                int j = 0;
                                
                                 for (int i = 0; i < opList.Rows.Count; i++)
                                 {
                                     string clearStr = "";
                                     clearStr = j == 5 ? "clearfix" : "";
                                     string tempMenu = opList.Rows[i]["OpModel"].ToString();
                                     if (menu != tempMenu)
                                     {
                                         menu = tempMenu;
                                         if (menu != "01")
                                         {
                                             j = 0;
                                         @:</div>
                                     }
                                     @:<div class="ItemTitle" style=" clear:both;">
                                     @:<input name="@menu" class="selectAll" type="checkbox"/>   @ViewData["Model" + menu]
                                     @:</div>
                                     @:<div class="ItemList" id="@menu">
                                 }
                                 
                                 
                                 <div style="width:220px; float:left;">
                                 <div class="checkedView" style="float:left; padding-bottom:8px;">
                                 @Html.CheckBox(opList.Rows[i]["ID"].ToString(), Convert.ToBoolean(opList.Rows[i]["RoleMark"]))
                                 </div>
                            
                            
                            
                                 <div class="theName" >
                                     @(" " + opList.Rows[i]["OpName"] + " ")
                                 </div> 
                                 </div>
                           
                                    @* if (clearStr != "")
                                     {
                                    <div class="@clearStr"></div>
                                     }*@
                                     j++;
                                     j = j == 6 ? 0 : j;
                                 }
                            }
                         }

                    
                                    </div>
                        <!--最小行单元-->
             
                        <div class="mt10 clearfix btnCenter" style="width: 900px;">
                          @* <div class="btnCenterBoxes">
                               <div class="classdetail_btn_box0101">
                                  <span class="classdetail_btn_box0102" onclick="ClickSave()">@ViewBag.Save</span> 
                               </div>
                           </div>*@
                           <div class="btnCenterBoxes">
                               <div class="classdetail_btn_box0101">
                                  <a href="@Url.Content("Index")"><span class="classdetail_btn_box0102">@ViewBag.Back</span></a>
                               </div>
                           </div>
                           
                        </div>
                    </div>
                </div>
            </div>

JS:

View Code
<script type="text/javascript">
        $(function () {
        //查看只可读角色页面
          $("select").attr("disabled", "disabled");
          $("input").attr("disabled", "disabled");
          $("textarea").attr("disabled", "disabled");

           //归类排版
             var deviceRole1=$("#0701").html();
             var deviceRole2=$("#0702").html();
              var deviceRole3=$("#0703").html();
               var deviceRole4=$("#0704").html();
                var deviceRole5=$("#0705").html();
                 var deviceRole6=$("#0706").html();
                  var deviceRole7=$("#0707").html();
                   var deviceRole8=$("#0708").html();
                    var deviceRole9=$("#0709").html();
                     var deviceRole10=$("#0710").html();
                      var deviceRole11=$("#0711").html();
                       var deviceRole12=$("#0712").html();
                        var deviceRole0=$("#0700").html();
$("#0704").html(deviceRole7);
$("#0703").html(deviceRole12);
$("#0705").html(deviceRole3);
$("#0706").html(deviceRole4);
$("#0707").html(deviceRole5);
$("#0708").html(deviceRole6);
$("#0708").after("<div class='clearfix'></div>");
$("#0709").html(deviceRole8);
$("#0710").html(deviceRole9);
$("#0711").html(deviceRole10);
$("#0712").html(deviceRole11);


            $(".selectAll").click(function () {
                var menuID = $(this).attr("name")
                var checked = $(this).attr("checked");
                //$("#" + menuID + " > input").attr("checked", checked == undefined ? false : checked);
                $("#" + menuID + " > div").find("input").attr("checked", checked == undefined ? false : checked);
            })
            $(".ItemList > div").find("input[type='checkbox']").click(function () {
                var checkSelect = true;
                var content = $(this).parent().parent();
                content.find("div").find("input[type='checkbox']").each(function () {
                    if (!$(this).attr("checked")) {
                        checkSelect = false;
                    }
                })
                var menuCode = content.attr("id");
                $("input[name='" + menuCode + "']").attr("checked", checkSelect);
            })
            $(".ItemList").each(function () {
                var checkSelect = true;
                $(this).find("div").find("input[type='checkbox']").each(function () {
                    if (!$(this).attr("checked")) {
                        checkSelect = false;
                    }
                })
                var menuCode = $(this).attr("id");
                $("input[name='" + menuCode + "']").attr("checked", checkSelect);
            })
            //关联
            $(".checkedView input").click(function(){
                var menuID = $(this).attr("name");
                var viewID=menuID.substr(0,34)+'00';
                if($(this).is(':checked') & menuID!=viewID){       
                if(viewID!="6a721c6f-dd4c-40b0-b51b-fbeb3bb21400")
                       $("input[name="+viewID+"]").attr("checked",true);
                 }
            });
        })

        //保存配置
        function ClickSave() {
        if (!validate()) {
                return;
            }
        var roleId='@ViewBag.RoleID';
        if(roleId=="")
           roleId="00000000-0000-0000-0000-000000000000";

        var roleName=$.trim($("#RoleName").val());
        if(roleName=="")
        {
           alert(Language_RoleManage_RoleNameReq);
           return false;
        }

            var url = "@Url.Action("RoleNameIsExists")?m=" + Math.random();
            $.post(url, {RoleID:roleId,RoleName:roleName}, function(data) {
                if (data == "true") {
                    alert(RoleManage_Add_Exists);
                    return true;
                } else {
                   RoleSet();
                }
            });
        }

        //保存权限分配
        function RoleSet()
        {
           var itemList = new Array();
            $(".ItemList > div").find("input[type='checkbox']").each(function () {
                if ($(this).attr("checked")) {
                    itemList.push($(this).attr("name"));
                }
            })

            
    

            var itemAll = itemList.join(",");
            var roleID = '@ViewBag.RoleID';
            if(roleID=="")
             roleID="00000000-0000-0000-0000-000000000000";

            var roleName=$("#RoleName").val();
            var remark=$("#Remark").val();
            var status=0;
            if($("#cbStatus").attr("checked")=="checked")
              status=1;

            //进行POST提交
            $.post('@Url.Action("Set")', { opIDList: itemAll, roleID: roleID,roleName:roleName,remark:remark,status:status }, function (data) {
                if (data == "true") {
                    //alert(Language_DeviceTypeManage_AddVersion_Success);
                    location.href='@Url.Content("Index")';
                }
                else {
                    alert(RoleManage_Set_Error);
                }
            })
        }
    </script>

CSS:

View Code
<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>

引用:

View Code
<script type="text/javascript" src="@Url.Content("~/js/jquery-1.7.1.min.js")"></script>
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/css/Class.css")" />
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/css/index.css")" />
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/css/easyui.css")" />
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/css/Language." + ViewBag.Lg + ".css")"/>
    <script type="text/javascript" src="@Url.Content("~/js/jquery.easyui.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/js/common.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/js/index.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/js/alertMessage." + ViewBag.Lg + ".js")"></script>
    <script type="text/javascript" src="@Url.Content("~/js/Language."+ViewBag.Lg+".js")"></script>

 

posted @ 2013-02-22 16:58  OpenCsharp.Net  阅读(404)  评论(0编辑  收藏  举报
华赐软件 Bootstrap3
w.huacisoft.com">华赐软件 Bootstrap3