<!DOCTYPE html>
<html lang=zh-cn>
<head>
    <meta charset=utf-8>
    <title>纵横计量支付系统</title>
    <meta name=description content=计量支付>
    <meta name=copyright content=smartcost.com.cn>
    <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>
<div class="wrapHeader">
    <h1 class="mainLogo" title="纵横计量支付"></h1>
    <div class="sysTools"><a title="返回首页" href="index.html"><i class="icon-circle-arrow-left icon-white"></i></a>&nbsp;&nbsp;&nbsp;<a
            title="纵横官网" target="_blank" href="http://smartcost.com.cn"><i class="icon-home icon-white"></i></a></div>
</div>
<!-- include "top" -->
<div class="warpAdmin">
    <!-- include "menu" -->
    <div class="adminContent">
        <div class="adminMain">
            <legend><a href="{{rootUrl}}manage/item/{{pid}}/section">返回标段列表</a></legend>
            <!-- if {{isnopm}} == 1 -->
            <table class="table table-striped table-hover">
                <legend><a mpid="{{nopmArray.mpid}}" id="adelete" href="#" class="fR btn btn-link colGray" times="{{nopmArray.times}}" nums = "{{nopmArray.numpname}}" data-toggle="modal">删除本期#{{nopmArray.times}}</a>
                    第{{nopmArray.numpname}}期 #{{nopmArray.times}} （未上报）
                </legend>
                <thead>
                <tr>
                    <th>审批流程</th>
                    <th>审批人</th>
                    <th>审批状态</th>
                    <th>审批意见</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <!-- loop nopmArray.audits -->
                <tr>
                    <td>{{nopmArray.audits' value.numaudit}}审</td>
                    <td>{{nopmArray.audits' value.name}}{{nopmArray.audits' value.company}}</td>
                    <td><span class="{{nopmArray.audits' value.colors}}">{{nopmArray.audits' value.status}}</span></td>
                    <td>{{nopmArray.audits' value.auditcontent}}</td>
                    <td></td>
                </tr>
                <!-- endloop -->
                </tbody>
            </table>
            <!-- endif -->

            <!-- loop pmArray -->
            <table class="table table-striped table-hover">
                <legend><!-- if {{isnopm}} == 0 --><!-- if {{keymax}} == {{pmArray' value.numpname}} --><a mpid="{{pmArray' value.mpid}}"
                                                                                id="adelete" href="#"
                                                                                class="fR btn btn-link colGray"
                                                                                times="{{pmArray' value.times}}"
                                                                                nums = "{{pmArray' value.numpname}}"
                                                                                data-toggle="modal">删除本期#{{pmArray' value.times}}</a><!-- endif -->
                    <!-- endif -->第{{pmArray' value.numpname}}期 #{{pmArray' value.times}}
                </legend>
                <thead>
                <tr>
                    <th>审批流程</th>
                    <th>审批人</th>
                    <th>审批状态</th>
                    <th>审批意见</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <!-- loop pmArray' value.audits -->
                <tr>
                    <td>{{pmArray' value' value.numaudit}}审</td>
                    <td>{{pmArray' value' value.name}}{{pmArray' value' value.company}}</td>
                    <td><span class="{{pmArray' value' value.colors}}">{{pmArray' value' value.status}}</span></td>
                    <td>{{pmArray' value' value.auditcontent}}</td>
                    <td>
                        <!-- if {{isnopm}} == 0 -->
                        <!-- if {{keymax}} == {{pmArray' value.numpname}} -->
                        <!-- if {{pmArray' value' value.enable}} == '2' -->
                        <a href="#checking" id="achecking" maid="{{pmArray' value' value.maid}}" data-toggle="modal"
                           class="colOrange">审核中</a>
                        <!-- endif -->
                        <!-- if {{pmArray' value' value.enable}} == '1' -->
                        <a href="#unpass" id="aunpass" maid="{{pmArray' value' value.maid}}" data-toggle="modal"
                           class="colRed">不通过</a>
                        <a href="#pass" id="apass" maid="{{pmArray' value' value.maid}}" data-toggle="modal" class="colGreen">通过</a>
                        <!-- endif -->
                        <!-- endif -->
                        <!-- endif -->
                    </td>
                </tr>
                <!-- endloop -->
                </tbody>
            </table>
            <!-- endloop -->
        </div>
    </div>
</div>
<!--不通过-->
<div class="modal fade" id="unpass">
    <div class="modal-dialog">
        <div class="modal-content">
            <input id="maid" name="maid" value="0" type="hidden"/>
            <input id="mpid" name="mpid" value="0" type="hidden"/>
            <input id="numpname" name="numpname" value="0" type="hidden"/>
            <input id="times" name="times" value="0" type="hidden"/>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">设置审批不通过</h4>
            </div>
            <div class="modal-body">
                <p>确认是否设置该审批人审批状态为审批不通过？</p>
            </div>
            <div class="modal-footer">
                <button id="btnunpass" class="btn btn-danger">确认</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--通过-->
<div class="modal fade" id="pass">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">设置审批通过</h4>
            </div>
            <div class="modal-body">
                <p>确认是否设置该审批人审批状态为审批通过？</p>
            </div>
            <div class="modal-footer">
                <button id="btnpass" class="btn btn-success">确认</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--审批中-->
<div class="modal fade" id="checking">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">设置审批中</h4>
            </div>
            <div class="modal-body">
                <p>确认是否设置该审批人审批状态为审批中？</p>
            </div>
            <div class="modal-footer">
                <button id="btnchecking" class="btn btn-warning">确认</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--删除本期-->
<div class="modal fade" id="delperiod">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">删除本期#<span class="times"></span></h4>
            </div>
            <div class="modal-body">
                <p>删除本期#<span class="times"></span>（第<span class="times"></span>次审批）后，将退回至上一次审批。</p>
                <p>当#1被删除后，将退回至上一期。</p>
                <p>确认是否删除第<span id="nums"></span>期#<span class="times"></span>？</p>
            </div>
            <div class="modal-footer">
                <button id="btndelete" class="btn btn-danger">确认</button>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--删除本标段第一期第一次时不可删除-->
<div class="modal fade" id="delperiod2">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">删除本期#<span class="times"></span>确认</h4>
            </div>
            <div class="modal-body">
                <p>当前标段下为第1期#1审批，不能删除本期，但可返回上一层删除这个标段。</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">autoFlashHeight();</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#achecking").click(function () {
            var maid = $(this).attr('maid');
            $("#maid").val(maid);
        });
        $("#aunpass").click(function () {
            var maid = $(this).attr('maid');
            $("#maid").val(maid);
        });
        $("#apass").click(function () {
            var maid = $(this).attr('maid');
            $("#maid").val(maid);
        });
        $("#adelete").click(function () {
            var mpid = $(this).attr('mpid');
            var times = $(this).attr('times');
            var nums = $(this).attr('nums');
            $("#mpid").val(mpid);
            $("#numpname").val(nums);
            $("#times").val(times-1);
            $(".times").html(times);
            $("#nums").html(nums);
            if(nums == 1 && times == 1){
                $('#delperiod2').modal('show');
            }else{
                $('#delperiod').modal('show');
            }
        });
        $("#btnpass").click(function () {
            var maid = $("#maid").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"op": 'pass', "maid": maid},
                url: "{{rootUrl}}manage/item/{{pmid}}/period",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#pass").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/{{pmid}}/period";
                    }
                }
            });
        });
        $("#btnunpass").click(function () {
            var maid = $("#maid").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"op": 'unpass', "maid": maid},
                url: "{{rootUrl}}manage/item/{{pmid}}/period",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#unpass").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/{{pmid}}/period";
                    }
                }
            });
        });
        $("#btndelete").click(function () {
            var mpid = $("#mpid").val();
            var nums = $("#numpname").val();
            var times = $("#times").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"op": 'delete', "numpname": nums, "times": times},
                url: "{{rootUrl}}manage/item/{{pmid}}/period",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#delperiod").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/{{pmid}}/period";
                    }
                }
            });
        });
        $("#btnchecking").click(function () {
            var maid = $("#maid").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"op": 'checking', "maid": maid},
                url: "{{rootUrl}}manage/item/{{pmid}}/period",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#checking").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/{{pmid}}/period";
                    }
                }
            });
        });
    });
</script>
</body>