<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">管理员管理</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
<div class="main">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="btn-group btn-group-sm">
                <button type="button" class="btn btn-default ui-selectInvert">反选</button>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        菜单<span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'增加管理员',url:'@Url.Action("Add")'">增加</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")',callBack:'LoadData'">删除</a></li>
                    </ul>
                </div>
            </td>
            <td class="right form-group-sm">
                <div class="controls form-inline">
                    <select id="siteIds" class="ui-queryString form-control ui-selectBind" data-source="@Html.GetSiteListJson()">
                        <option value="">选择可管理站点</option>
                    </select>
                    <select id="roleId" class="ui-queryString form-control ui-selectBind" data-source="@Html.GetRoleListJson()">
                        <option value="">选择角色</option>
                    </select>
                    <input type="text" id="username" class="ui-queryString form-control" style="width:120px" placeholder="用户名">
                    <button type="button" class="btn btn-default ui-queryString-search btn-sm">搜索</button>
                </div>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered" id="tb_list">
        <thead>
            <tr>
                <td align="center" style="width:40px"><input type="checkbox" class="ui-selectInvert" /></td>
                <td align="left">用户名</td>
                <td>管理员角色</td>
                <td>备注</td>
                <td align="center">信息权限</td>
                <td align="center">操作</td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}">
            <td align="center"><input type="checkbox"  value="{id}" class="checked-item"></td>
            <td align="left">{username}</td>
            <td><span class="sp_roleid" data-custom-params="">{roleId}</span></td>
            <td>{remark}</td>
            <td align="center"><a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog is_superadmin_{roleId}" data-custom-params="title:'{username}-信息管理权限设置',url:'@Url.Action("Index","AdminInfoPermissions")?uid={uid}'">设置</a></td>
            <td align="center">
                <input type="hidden" name="id" value="{id}" />
                <div class="btn-group btn-group-sm">
                    <button class="btn btn-default btn-sm ui-dialog"  data-custom-params="title:'{username}-管理员设置',url:'@Url.Action("Edit")?id={id}'">修改</button>
                    <button class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url: '@Url.Action("Delete")',callBack:'LoadData'">删除</button>
                </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">

    $("#siteIds").SelectBind({dataSourceFrom:"attr"});
    $("#roleId").SelectBind({ dataSourceFrom: "attr" });

    function LoadData() {
        var url = "@Url.Action("PageListData")"
        $("#tb_list").ListBind({url:url,callBack: "LoadedInit" });
    }
    function LoadedInit() {
        $(".sp_roleid").ConvertText({}, $("#roleId").attr("data-source"));
        $(".is_superadmin_1").attr("disabled", "disabled");
    }
    LoadData();
</script>