<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><span>@ViewBag.CurrentSiteName</span> &gt; <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" id="tbHead">
        <tr>
            <td>
                <div class="btn-group">
                    <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown" aria-expanded="false">
                        菜单
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li>
                            <a class="ui-dialog" href="javascript:void(0)" data-custom-params="title:'添加一级栏目',url:'@Url.ActionUrl("Add")',width:'100%',height:'100%',target:'self'">添加</a>
                        </li>
                        <li class="divider"></li>
                        <li><a class="ui-updateMultiple" href="javascript:void(0)" data-custom-params="url:'@Url.ActionUrl("UpdateList")',callBack:'LoadData'">更新</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-setField" data-custom-params="url:'@Url.ActionUrl("SetField")',setField:'isFinal',setValue:'1',limitFinal:'0',includeChildNode:'0',callBack:'LoadData'">转为最终栏目</a></li>
                        <li><a href="javascript:void(0)" class="ui-setField" data-custom-params="url:'@Url.ActionUrl("SetField")',setField:'isFinal',setValue:'0',limitFinal:'1',callBack:'LoadData'">转为非最终栏目</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-setMultiple" data-custom-params="title:'栏目批设置',url:'@Url.ActionUrl("SetMultiple")'">批设属性</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-setMultiple" data-custom-params="title:'栏目转移',url:'@Url.ActionUrl("Transfer")',width:'600px',height:'90%'">转移</a></li>
                        <li class="divider"></li>
                        <li><a class="ui-deleteMultiple" href="javascript:void(0)" data-custom-params="url:'@Url.ActionUrl("Delete")',async:false,callBack:'LoadData',reverseExecute:true">删除</a></li>
                    </ul>
                </div>
            </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 title="您也可以点击每个栏目名称前面的文件夹图标实现展开或关闭"><span>栏目/</span><span class="ui-folder-switch">展开</span></td>
                <td align="center">Id</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 parent_{parentId} list-template-item" id='item_{id}' data-parentId="{parentId}" data-isFinal="{isFinal}" data-id="{id}">
            <td align="center"><input type="checkbox" value="{id}" class="checked-item"></td>
            <td>{space}<span class="node node_{isFinal}"></span><span>{name}</span><a href="/E/preview/column?id={id}" target="_blank" title="预览"><span class="glyphicon glyphicon-eye-open"></span></a></td>
            <td align="center">{id}</td>
            <td align="center">
                <span class="sp_column_type">{columnType}</span><span class="sp_table_id" data-custom-params="url:'@Url.ActionUrl("GetFieldByIds", "InfoTable")',textField:'Remark'">{tableId}</span>
            </td>
            <td align="center"><span class="is-{show}"></span></td>
            @*<td align="center">{path}</td>*@
            <td align="center">
                <input type="text" name="xuhao" id="xuhao" class="form-control ui-listXuhao" value="{xuhao}" data-table="pa_column" data-id="{id}" style="width:50px" maxlength="3" />
            </td>
            <td align="center">
                <button type="button" data-custom-params="title:'{name}-添加子栏目',url:'@Url.ActionUrl("add")?parentId={id}'" class="btn btn-sm btn-default btn-is-final-{isFinal} ui-dialog">添加</button>
            </td>
            <td align="center">
                <input type="hidden" id="id" name="id" value="{id}">
                <div class="btn-group btn-group-sm">
                    <button type="button" data-custom-params="title:'{name}-编辑',url:'@Url.ActionUrl("Edit")?id={id}',width:'100%',height:'100%',target:'self',shadeClose:false" class="btn btn-sm btn-default ui-dialog">修改</button>
                    <button type="button" data-custom-params="url:'@Url.ActionUrl("Delete")',callBack:'LoadData'" class="btn btn-sm btn-default ui-deleteSingle">删除</button>
                </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    function LoadedInit() {
        $(".btn-is-final-1").attr("disabled", "disabled");//禁用最终菜单的添加下级按钮
        var $sp_thetype = $(".sp_column_type");
        $sp_thetype.each(function () {
            var $this = $(this);
            var thisText = $this.text();
            var $thisNext = $this.next();
            $thisNext.hide().removeClass("sp_table_id");
            if (thisText == "3") {
                $this.text("外链");
            }
            if (thisText == "2") {
                $this.text("单页面");
            }
            if (thisText == "1") {

                $this.hide();
                $thisNext.show().addClass("sp_table_id");;
            }
            else if (thisText == "0") {
                $this.text("首页");
            }
        });
        var $sp_table_id = $(".sp_table_id");
        $sp_table_id.ConvertText({emptyStr: "-" });
    }
    var $tbList = $("#tb_list");

    function LoadData() {
        var params = { url: "@Url.ActionUrl("ListData")", callBack: "LoadedInit" };
        $tbList.TreeBind(params);
    }
    LoadData();

</script>
