<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 border=0 cellpadding=0 cellspacing=0 class="tb-head form-inline form-group-sm">
        <tr>
            <td>
                    <div class="btn-group btn-group-sm">
                        <button type="button" class="btn btn-default ui-selectInvert">反选</button>
                        <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.ActionUrl("Add")',width:'680px',height:'340px'">添加</a></li>
                            <li class="divider"></li>
                            <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.ActionUrl("Delete")',beforeExecute:'BeforeDelete',callBack:'LoadData'">删除</a></li>
                        </ul>
                    </div>
            </td>
            <td align="right">
                <select class="form-control form-control-xs ui-queryString ui-setName">
                    <option value="name">按表名搜索</option>
                    <option value="remark">按标识搜索</option>
                </select>
                <input type="text" maxlength="19" class="form-control ui-keyword  ui-queryString" style="width:100px;">
                <input type="button" value="确定" class="btn btn-default btn-sm ui-queryString-search">
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered form-inline form-group-sm" id="tb_list">
        <thead>
            <tr>
                <td align="center" style="width:40px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
                <td align="center">表名</td>
                <td align="center">标识</td>
                @*<td align="center">创建人</td>*@
                <td align="center">创建时间</td>
                <td align="center">删除保护</td>
                <td align="center">数据管理</td>
                <td align="center">字段管理</td>
                <td align="center">操作</td>
            </tr>
        </thead>
        <tr class="item" id="item_{id}" delete_protect="{deleteProtect}">
            <td align="center"><input type="checkbox"  value="{id}" class="checked-item"></td>
            <td align="center" class="name">{name}</td>
            <td align="center">{remark}</td>
            @*<td align="center"><span class="lb_uid" data-custom-params="url:'@Url.ActionUrl("GetFieldByIds", "Member")',textField:'username'">{uid}</span></td>*@
            <td align="center"><span class="lb_thedate">{thedate}</span></td>
            <td align="center"><span class="is-{deleteProtect}"></span></td>
            <td align="center"><button type="button" data-custom-params="title:'{remark}',url:'@Url.ActionUrl("index","CategoryDataAdmin")?table={name}'" class="btn btn-default btn-sm ui-dialog">管理</button></td>
            <td align="center"><button type="button" data-custom-params="title:'{remark}-字段管理',url:'@Url.ActionUrl("Index","Field")?tableName={name}'" class="btn btn-default btn-sm ui-dialog">管理</button></td>
            <td align="center">
                <input type="hidden" name="id" value="{id}" />
                <div class="btn-group btn-group-sm">
                    <button type="button" data-custom-params="title:'{remark}-修改',url:'@Url.ActionUrl("Edit")?id={id}',width:'680px',height:'340px'" class="btn btn-default btn-sm ui-dialog">修改</button>
                    <button type="button" data-custom-params="url:'@Url.ActionUrl("Delete")',callBack:'LoadData'" class="btn btn-default btn-sm ui-deleteSingle btn_delete_{deleteProtect}">删除</button>
                </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">

    function LoadData()
    {
        var url = "@Url.ActionUrl("PageListData")";
        $("#tb_list").ListBind({url:url,callBack: "LoadedInit" });
    }
    function LoadedInit()
    {
        var $btn_protect = $(".btn_delete_1");
        $btn_protect.attr("disabled", "disabled");

        var $lb_thedate = $(".lb_thedate");
        $lb_thedate.each(function () {
            var $this = $(this);
            $this.html($this.html().split(" ")[0]);
        })
    }
    LoadData();

    function DelCallBack(id) {
        $("#item_" + id).hide();
    }
    function BeforeDelete(ids) {
        var arrIds = ids.split(",")
        for (i = 0; i < arrIds.length; i++) {
            if ($("#item_" + arrIds[i]).attr("delete_protect") == "1") {
                Alert("启用删除保护的表不能删除！");
                return false;
            }
        }
        return true;

    }
</script>
