@model string
<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>
@Html.Action("Tabhead", "Friends")
<div class="main no-top-border">
    <div class="control-group">
        <table class="controls tb_head" cellpadding="0" cellspacing="0" border="0">
            <tr class="clearfix">
                <td class="btn-group left">
                    <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 href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'添加好友',url:'@Url.Action("Add","FriendRequest")',width:'680px',height:'320px',target:'_self'">添加好友</a></li>
                        <li><a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'好友分组',url:'@Url.Action("Index","FriendsSort")',width:'80%',height:'90%'">好友分组</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")'">删除</a></li>
                    </ul>
                </td>
                <td class="right form-group-sm form-inline">
                    <select id="sortid" name="sortid" class="form-control ui-queryString">
                        <option value="">选择好友分组</option>
                    </select>
                    <select id="order" class="form-control ui-queryString">
                        <option value="">选择排序方式</option>
                        <option value="thedate desc">按添加时间↓</option>
                        <option value="thedate asc">按添加时间↑</option>
                    </select>
                    <input type="text" id="thedate" name="thedate" placeholder="开始日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                    <input type="text" id="thedate" name="thedate" placeholder="结束日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                    <select id="field" name="field" class="form-control ui-queryString ui-setName">
                        <option value="owner_uid">好友用户名</option>
                        <option value="remark">好友备注</option>
                    </select>
                    <input type="text" id="keyword" name="keyword" style="width:100px" placeholder="请输入关键词" class="form-control ui-queryString ui-keyword">
                    <button type="button" class="btn btn-default btn-sm ui-queryString-search">确定</button>
                </td>
            </tr>
        </table>
        <span class="help-block"></span>
    </div>
    <table border=0 cellpadding=0 cellspacing=0 width=100% class="table table-bordered" 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>
        </tr>
        <tr class="item" id="item_{id}">
            <td align="center"><input type="checkbox" id="id" name="id" value="{id}"></td>
            <td align=left>
                <span class="ui-convertTextById Member" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'">{owner_uid}</span>
            </td>
            <td align="center">{remark}</td>
            <td align="center" class="sortid">{sortid}</td>
            <td align="center">{thedate}</td>
            <td align="center">
                <div class="btn-group btn-group-sm">
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'修改-{owner_uid}',url:'@Url.Action("Edit")?id={id}',width:'680px',height:'290px'">修改</a>
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url: '@Url.Action("Delete")', id:'{id}'">删除</a>
                </div>
            </td>
        </tr>
    </table>
</div>

<script type="text/javascript">
    document.write('<' + 'script type="text/javascript" src="' + baseUrl + '/js/list.js"></' + 'script>');
    var params = { valueField: "id", textField: "name" }
    var sortid = eval(CallAjax("get", false, "@Url.Action("ListData", "FriendsSort")"));
    $("#sortid").FillSelect(sortid, params);

    function LoadData()
    {
        var url = "@Url.Action("PageListData")"
        $("#tb_list").ListBind(url, {callBack: "LoadedInit" });
        ConvertText($(".Member"));

        $(function () {
            for (var key in sortid) {
                $(".sortid").each(function (i) {
                    if ($(this).text() == sortid[key].id) {
                        $(this).text(sortid[key].name);
                    } else if ($(this).text() == "0") {
                        $(this).text("无分组");
                    }
                })
            }
        })

    }

    LoadData();


</script>