<!DOCTYPE html>
<html lang=zh-cn>
<head>
    <meta charset=utf-8>
    <title>纵横计量支付系统</title>
    <meta name=description content=计量支付>
    <meta name=copyright content=smartcost.com.cn>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel=stylesheet href="{{rootUrl}}global/css/bootstrap.css">
    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
    <script src={{rootUrl}}global/js/bootstrap.js></script>
    <script src={{rootUrl}}global/js/jl.js></script>
</head>
<body>
<!-- include "top" -->
<div class="wrapContent">
    <!-- include "left" -->
    <div class="mainContainer">
        <!--内容-->
        <div class="mainContent">
            <div class="title clearfix">
                <h1><a href="/sign/index" title="返回"><span class="closePanel" aria-hidden="true"
                                                               data-icon="Z"></span></a>&nbsp;所有报表</h1>
            </div>
            <div class="project">
                <div class="proSection">
                    <ul class="nav nav-pills">
                        <li>
                            <select class="form-control" id="itemlist">
                                <option value="0">请选择项目</option>
                                <!-- if !empty({{itemlist}}) -->
                                <!-- loop itemlist -->
                                <option value="{{itemlist' value.project}}" <!-- if {{project}} == {{itemlist' value.project}} -->selected<!-- endif --> >{{itemlist' value.pname}}</option>
                                <!-- endloop -->
                                <!-- endif -->
                            </select>&nbsp;
                        </li>
                        <li>
                            <select class="form-control" id="tenderlist">
                                <option value="0">请选择标段</option>
                                <!-- if !empty({{tenderlist}}) -->
                                <!-- loop tenderlist -->
                                <option value="{{tenderlist' value.tender}}" <!-- if {{tender}} == {{tenderlist' value.tender}} -->selected<!-- endif -->>{{tenderlist' value.pmname}}</option>
                                <!-- endloop -->
                                <!-- endif -->
                            </select>&nbsp;
                        </li>
                        <li>
                            <select class="form-control" id="phasenolist">
                                <option value="0">请选择期数</option>
                                <!-- if !empty({{phasenolist}}) -->
                                <!-- loop phasenolist -->
                                <option value="{{phasenolist' value.phaseno}}" <!-- if {{phaseno}} == {{phasenolist' value.phaseno}} -->selected<!-- endif -->>第{{ToChinaseNum(phasenolist' value.numpname)}}期</option>
                                <!-- endloop -->
                                <!-- endif -->
                            </select>&nbsp;
                        </li>
                        <li>
                            <div class="checkbox"><label>&nbsp;<input type="checkbox" id="nosign" <!-- if {{nosign}} == 1 -->checked<!-- endif -->>未发起签署报表</label></div>
                        </li>
                    </ul>
                    <table class="table">
                        <thead>
                        <tr>
                            <th width="40%">报表名</th>
                            <th width="20%">项目-标段-期数</th>
                            <th width="10%">生成</th>
                            <th width="10%">发起</th>
                            <th width="10%">状态</th>
                            <th width="10%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <!-- if !empty({{list}}) -->
                        <!-- loop list -->
                        <tr>
                            <td width="">{{list' value.name}}</td>
                            <td>{{list' value.project}}-{{list' value.tender}}-第{{ToChinaseNum(list' value.phaseno)}}期</td>
                            <td>{{list' value.ownname}}<br>{{formatDate(list' value.intime,'Y-m-d')}}</td>
                            <td><!-- if !empty({{list' value.auditname}}) -->{{list' value.auditname}}<!-- endif --><br><!-- if !empty({{list' value.aintime}}) -->{{formatDate(list' value.aintime,'Y-m-d')}}<!-- endif --></td>
                            <td><!-- if {{list' value.status}} == 'checked' --><span class="colGreen">完成</span><br>{{formatDate(list' value.sintime,'Y-m-d')}}<!-- elseif {{list' value.status}} == 'checking' --><span class="colOrange">签署中</span><br><!-- elseif {{list' value.status}} == 'uncheck' -->未发起签署<!-- elseif {{list' value.status}} == 'stop' --><span class="colRed">终止</span><br>{{formatDate(list' value.sintime,'Y-m-d')}}<!-- elseif {{list' value.status}} == 'back' --><span class="colOrange">退回</span><br>{{formatDate(list' value.sintime,'Y-m-d')}}<!-- endif --></td>
                            <td width=""><a class="btn btn-default btn-sm" href="/sign/view/{{list' value.sid}}">查看报表</a><!-- if {{list' value.delstatus}} == 1 -->&nbsp;<a class="btn btn-danger btn-sm delbtn" href="#del" data-toggle="modal" delid="{{list' value.sid}}">删除</a><!-- endif --></td>
                        </tr>
                        <!-- endloop -->
                        <!-- endif -->
                        </tbody>
                    </table>
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            {{pager}}
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
        <!--内容-->
    </div>
</div>
<div id="del" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <h4>确认删除该报表？</h4>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="delid" value="">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-danger" id="delbtn2">确认删除</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">autoFlashHeight();</script>
<script>
    $(function(){
        $('#itemlist').change(function(){
            var url = '/sign/list';
            if($(this).val() != 0){
                url += '/project/'+$(this).val();
            }
            if($('#nosign').is(':checked')){
                url += '/nosign';
            }
            window.location.href = url;
        });

        $('#tenderlist').change(function(){
            var url = '/sign/list/project/'+$('#itemlist').val();
            if($(this).val() != 0){
                url += '/tender/'+$(this).val();
            }
            if($('#nosign').is(':checked')){
                url += '/nosign';
            }
            window.location.href = url;
        });

        $('#phasenolist').change(function(){
            var url = '/sign/list/project/'+$('#itemlist').val()+'/tender/'+$('#tenderlist').val();
            if($(this).val() != 0){
                url += '/phaseno/'+$(this).val();
            }
            if($('#nosign').is(':checked')){
                url += '/nosign';
            }
            window.location.href = url;
        });

        $('#nosign').change(function(){
            var url = '/sign/list';
            if($('#itemlist').val() != 0){
                url += '/project/'+$('#itemlist').val();
            }
            if($('#tenderlist').val() != 0){
                url += '/tender/'+$('#tenderlist').val();
            }
            if($('#phasenolist').val() != 0){
                url += '/phaseno/'+$('#phasenolist').val();
            }
            if($(this).is(':checked')){
                url += '/nosign';
            }
            window.location.href = url;
        });

        $('.delbtn').on('click',function(){
            $('#delid').val($(this).attr('delid'));
        });

        $('#delbtn2').click(function(){
            var id = $('#delid').val();
            $.ajax({
                type: 'post',
                url: '/sign/list',
                data:{delid:id},
                dataType: 'json',
                success: function(data){
                    if(data.code == 200){
                        var url = '/sign/list';
                        if($('#itemlist').val() != 0){
                            url += '/project/'+$('#itemlist').val();
                        }
                        if($('#tenderlist').val() != 0){
                            url += '/tender/'+$('#tenderlist').val();
                        }
                        if($('#phasenolist').val() != 0){
                            url += '/phaseno/'+$('#phasenolist').val();
                        }
                        if($('#nosign').is(':checked')){
                            url += '/nosign';
                        }
                        window.location.href = url;
                    }else{
                        alert('删除出错');
                    }
                }
            })
        })

    })
</script>
</body>