
<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 align="left">
                <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" aria-expanded="false">
                        菜单
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu pull-left" role="menu">
                        <li>
                            <a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'添加信息表',url:'@Url.ActionUrl("Add")?thetype=infotable'">添加</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-updateMultiple" data-custom-params="url:'@Url.ActionUrl("UpdateList")',callBack:'LoadData'">更新</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 id="siteId" name="siteId" class="form-control form-control-xs ui-queryString ui-queryString-search" data-source="@Html.GetSiteListJson()">
                    <option value="">所有应用站点</option>
                </select>
                <select class="form-control form-control-xs ui-queryString ui-setName">
                    <option value="name">按表名搜索</option>
                    <option value="remark">按标识搜索</option>
                </select>
                <input type="text" placeholder="搜索关键词" class="form-control ui-keyword ui-queryString">
                <button type="button" class="btn btn-default btn-sm ui-queryString-search">搜索</button>
            </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>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}" delete_protect="{deleteProtect}">
            <td align="center"><input type="checkbox" class="checked-item" value="{id}"></td>
            <td align="center">
                <div class="dropdown dropdown-hover">
                    <a class="dropdown-toggle" data-toggle="dropdown">
                        <span>{name}</span>
                        <span class="caret"></span>
                    </a>
                    <div class="dropdown-menu item-detail" role="menu">
                        <table class="table" style="width:400px">
                            <tr>
                                <td>应用站点：<span class="lb_siteId" data-custom-params="url:'@Url.ActionUrl("GetFieldByIds", "Site")',textField:'Name'">{siteId}</span></td>
                                <td>创建时间：<span class="lb_thedate">{thedate}</span></td>
                            </tr>

                        </table>
                    </div>
                </div>
            </td>
            <td align="center">{remark}</td>
            <td align="center"><span class="is-{deleteProtect}"></span></td>
            <td align="center">
                <input type="text" name="xuhao" id="xuhao" class="form-control ui-listXuhao" value='{xuhao}' data-table="pa_info_table" data-id="{id}" style="width:50px" maxlength="3" />
            </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">
                <button type="button" data-custom-params="title:'{remark}-信息管理',url:'@Url.ActionUrl("Index","InfoData")?table={name}&_from=infotable'" 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" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'{remark}-修改',url:'@Url.ActionUrl("Edit")?id={id}'">修改</button>
                    <button type="button" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'{remark}-复制',url:'@Url.ActionUrl("Copy")?id={id}'">复制</button>
                    <button type="button" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'表单Html',url:'@Url.ActionUrl("FormHtml")?table={name}'">表单Html</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">
    var $siteId = $("#siteId");
    var siteData = $siteId.attr("data-source");
    $siteId.SelectBind({}, siteData);
    $siteId.SetValue("@ViewBag.CurrentSiteId")


    function LoadData() {
        $("#tb_list").ListBind({url:"@Url.ActionUrl("PageListData")",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]);
        });
        $(".lb_siteId").ConvertText({}, siteData);
        $(".dropdown-hover").DropdownHover();
    }
    LoadData();

    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>

