
<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="head-tab" id="head_tab">
    <ul>
        @*<li data-state="" class="current">所有签发</li>*@
        <li data-state="0" class="current">待签发</li>
        <li data-state="1">已签发</li>
    </ul>
</div>
<div class="main no-top-border">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="left">
                <div class="btn-group btn-group-sm top_panel">
                    <button type="button" class="btn btn-default ui-selectInvert">反选</button>
                    <button type="button" class="btn btn-default ui-setMultiple btn_pissue" data-custom-params="setName:'PIssue',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="publisher" valueType="nvarchar" searchtype="fuzzy">按发布用户</option>
                    <option value="thedate" valueType="datetime" searchType="range">提交日期</option>
                    <option value="issue_date" valueType="datetime" searchType="range">签发日期</option>
                </select>
                <input type="text" id="title" name="title" 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="left">标题</td>
            <td align="left">提交日期</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>
            <a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'查看',url:'@Url.Action("Preview", "InfoData")?table={table}&id={detail_id}',width:'90%',height:'90%'"><span class="lb_title" data-custom-params="url:'@Url.Action("GetFieldByIds","InfoData")?table={table}',textField:'title'">{detail_id}</span></a>
            </td>
            <td align="center">{thedate}</td>
            <td align="center"><span class="lb_workflow_node" data-custom-params="url:'@Url.Action("GetFieldByIds","WorkFlowNode")',textField:'name'">{workflow_node_id}</span></td>
            <td align="center">
                <span class="sp_state is-{state}"></span>
                <div class="ps_detail" style="display:none;width:100%;text-align:left">
                   操作：{issue_act}
                    <br />备注：{issue_remark} 
                    <br />签发日期：{issue_date} &nbsp;&nbsp;
                </div>
            </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("Index", "InfoOperationLog")?table={table}&detail_id={detail_id}',width:'800px',height:'80%'" >详情</a>
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog btn_issue" data-custom-params="title:'签发信息',url:'@Url.Action("Issue")?id={id}',width:'700px',height:'300px'">签发</a>
                </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">

    var $top_panel = $(".top_panel");
    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");
        if (state==1)
        {
            $top_panel.hide();
        }
        else
        {
            $top_panel.show();
        }
        $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()
    {
        $btn_issue = $(".btn_issue");
        $sp_state = $(".sp_state");
        $sp_state.each(function (index) {
            var $this = $(this);
            if($this.hasClass("is-1"))
            {
                $this.hide().siblings().show();
                $btn_issue.eq(index).attr("disabled", "disabled");
            }

        });
        $sp_issue_date = $(".sp_issue_date");
        ConvertText($(".lb_title"));
        ConvertText($(".lb_workflow_node"));
    }

    LoadData();
   

    //设置前检测
    function BeforeExecuting(ids, setName) {
        var Aids = ids.split(",");
        var currentObj, guid, childObj;
        switch (setName) {
            case "PIssue":
                var params = { title: '批量签发', url: '@Url.Action("PIssue")?ids=' + ids, width: '700px', height: '250px' };
                IDialog(params);
                return false;
                break;
        }
        return true;
    }
</script>