@{ 
    CurrentUser user = ViewBag.CurrentUser;
    string tableType = ViewBag.TableType;
    int infoTableId = StringHelper.Format<int>(ViewBag.InfoTableId);
}
<div class="main">
    <table border=0 cellpadding=0 cellspacing=0 class="tb-head form-inline form-group-sm">
        <tr>
            <td align="right">
                @if (tableType == "column")
                {
                <select name="siteId" id="siteId" style="width:auto;display:inline" class="form-control ui-queryString ui-queryString-search" data-source="@Html.GetSiteListJsonByUser(user)" data-custom-params="dataSourceFrom:'attr',textField:'Remark'">
                    <option value="0">选择栏目所属站点</option>
                </select>
                }
                else if (tableType == "member")
                {
                    <select id="memberGroupId" class="ui-queryString form-control ui-queryString-search" data-source="@Html.GetCanAdminMemberGroupListJson()" data-custom-params="dataSourceFrom:'attr',valueField:'Id',textField:'Name'">
                        <option value="">所有会员组</option>
                    </select>
                    <select id="departmentId" class="ui-queryString form-control  ui-queryString-search" data-source="@Html.GetDepartmentListJson()" data-custom-params="dataSourceFrom:'attr',valueField:'Id',textField:'Name',onlySelectFinal:false,isTree:true">
                        <option value="">所有部门</option>
                    </select>
                }
                else if (tableType == "infoTable")
                {
                    <select name="columnId" id="columnId" class="form-control ui-queryString ui-queryString-search" data-custom-params="isTree:true" data-source="@Html.GetColumnListJsonByUser(infoTableId,user)">
                        <option value="">所有栏目</option>
                    </select>
                }
                <input type="hidden" id="fieldId" name="fieldId" class="ui-queryString" value="@ViewBag.FieldId" />
                <input type="text" id="@ViewBag.TextField" name="@ViewBag.TextField" maxlength="30" class="form-control  ui-queryString" style="width:140px;">
                <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 style="width:50px" align="center"><input type="checkbox" title="选择" class="ui-selectInvert hidden" data-custom-params="isReverse:false">选择</td>
                <td align=left>@ViewBag.TextfieldName</td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}">
            <td align="center"><input type="checkbox" id="id" name="id" value="{@ViewBag.ValueField}" class="checked-item id_{id}"></td>
            <td align=left><span class="title">{@ViewBag.TextField}</span></td>
        </tr>
    </table>
    <div class="submit-footerbar">
        <label class="control-label"></label>
        <div class="controls">
            <button type="button" class="btn btn-primary btn-sm ui-closeDialog">确定</button>
            <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
        </div>
    </div>
</div>
<script src="/Js/selectData.js" type="text/javascript"></script>
<script type="text/javascript">
    var onlySelectFinal=@ViewBag.OnlySelectFinal;
    var isTree=@ViewBag.IsTree;
    var $tbList=$("#tb_list");
    $("#siteId").SelectBind();
    $("#memberGroupId").SelectBind();
    var siteId = "@ViewBag.CurrentSiteId";
    $("#siteId").SetValue(siteId);
    $("#departmentId").SelectBind();
    $("#columnId").SelectBind();

    function LoadData()
    {
        var url="@Url.ActionUrl("PageListData","SelectData")";
        $tbList.ListBind({url:url,callBack: "LoadedInit" });
    }
    LoadData();

    function LoadedInit()
    {
        var $title = $(".title");
        $title.each(function () {
            var $this = $(this);
            if ($this.html().length>60) {
                $this.html($this.html().substring(0,60)+"...");
            }
        });
        SetSelectedDisabled() //把已经选中的设置为Disabled
    }

</script>