
<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">
    <div class="head-tab" id="head_tab">
        <ul>
            <li data-state="0" class="current">待回复</li>
            <li data-state="1">处理中</li>
            <li data-state="2">转办中</li>
            <li data-state="3">已回复</li>
            <li data-state="4">已结束</li>
        </ul>
    </div>
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <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 ui-setMultiple btn_setstate" data-custom-params="setName:'setState',beforeExecute:'BeforeExecuting'">设置状态</button>
                    </div>
                </td>*@

            <td class="right form-inline form-group-sm">
                <input type="hidden" id="state" name="state" value="0" class="ui-queryString" />
                <select id="s_field" name="s_field" class="btn-xs ui-queryString ui-setName form-control">
                    <option value="column_name" valueType="nvarchar" searchtype="fuzzy">按标题</option>
                    <option value="title" valueType="nvarchar" searchtype="fuzzy">按分类</option>
                    <option value="publisher" valueType="nvarchar" searchtype="fuzzy">按发布用户</option>
                    <option value="table" valueType="nvarchar" searchType="fuzzy">按来源表</option>
                    <option value="thedate" valueType="date" searchType="range">按提交日期</option>
                </select>
                <input type="text" class="ui-queryString ui-keyword  form-control" placeholder="输入关键词">
                <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" id="tb_list">
        <thead>
            <tr>
                @*<td align="center" width="30px"><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>
            <tr class="item template-item">
                @*<td align="center"><input type="checkbox" id="id" name="id" value="{id}"></td>*@
                <td align=left>
                    {title}<a href="/api/preview/info?table={table}&id={detail_id}" target="_blank" class="urlview" title="预览"></a>
                </td>
                <td align="center">{column_name}</td>
                <td align="center">{table}</td>
                <td align="center">{publisher}</td>
                <td align="center">{thedate}</td>
                <td align="center"><span class="sp_state" data-state="{state}"></span></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:'信息详情',url:'@Url.Action("Detail")?table={table}&detail_id={detail_id}&id={id}',width:'90%',height:'90%'">详情</a>
                    </div>
                </td>
            </tr>
    </table>
</div>
<script type="text/javascript">

    var $state = $("#state");
    var $btsearch = $(".ui-queryString-search");
    var $head_tab_item = $("#head_tab").children("ul").children("li");
    $head_tab_item.click(function () {
        var $this = $(this);
        var state = $this.attr("data-state");
        $state.val(state);
        $this.addClass("current").siblings().removeClass("current");
        $btsearch.click();
    })


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

    function LoadedInit() {
        var $spState = $(".sp_state");
        var states = new Array("待处理", "处理中", "转办中", "已回复", "已结束");
        $spState.each(function () {
            var $this = $(this);
            var state = $this.attr("data-state");
            var stateName = states[parseInt(state)];
            $this.html(stateName);
        });
    }

    LoadData();

</script>